<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>{% block title %}广告系统{% endblock %}</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            font-family: 'Segoe UI', sans-serif;
            background: #f0f2f5;
            min-height: 100vh;
        }

        .navbar {
            background: white;
            padding: 15px 30px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            box-shadow: 0 7px 15px rgba(0,0,0,0.05);
            position: sticky;
            top: 0;
            z-index: 1000;
            border-radius: 20px;
        }

        .navbar .left {
            font-weight: bold;
            font-size: 18px;
            color: #2d3436;
            background-color: #ffffff;
            padding: 6px 16px;
        }

        .navbar .right {
            display: flex;
            align-items: center;
            gap: 20px;
        }

        .navbar .right span {
            color: #636e72;
            font-size: 15px;
        }

        .navbar button {
            background-color: #d63031;
            color: white;
            border: none;
            padding: 6px 12px;
            border-radius: 4px;
            cursor: pointer;
            transition: background 0.3s;
        }

        .navbar button:hover {
            background-color: #c0392b;
        }

        .main-container {
            padding: 40px;
            max-width: 1200px;
            margin: 0 auto;
        }

    </style>
</head>
<body>
    <div class="navbar">
        <div class="left">🎯 广告系统</div>
        <div class="right">
            {% if request.user.is_authenticated %}
                <span>👤 {{ request.user.username }}（{{ request.user.role }}）</span>
                <form method="POST" action="{% url 'logout' %}">
                    {% csrf_token %}
                    <button type="submit">退出登录</button>
                </form>
            {% else %}
                <a href="{% url 'login_page' %}">登录</a>
            {% endif %}
        </div>
    </div>

    <div class="main-container">
        <div class="content-box">
            {% block content %}
            <!-- 子页面内容插入点 -->
            {% endblock %}
        </div>
    </div>
</body>
</html>
